package com.gewu.pm.ui.adapter.home;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;
import com.gewu.pm.bean.TestBean;

/**
 * 终端应收报表列表适配器
 */
public class TerminalReceivableAdapter extends AppAdapter<TestBean> {

    public TerminalReceivableAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ItemViewHolder();
    }

    private final class ItemViewHolder extends AppAdapter<?>.ViewHolder {

        private final TextView mTitleView;
        private final TextView mTerminalCodeView;
        private final TextView mAmountView;

        private ItemViewHolder() {
            super(R.layout.terminal_receivable_item);
            mTitleView = findViewById(R.id.tv_title);
            mTerminalCodeView = findViewById(R.id.tv_terminal_code);
            mAmountView = findViewById(R.id.tv_amount);
        }

        @Override
        public void onBindView(int position) {
            TestBean item = getItem(position);
            
            // 设置终端名称
            mTitleView.setText(item.getName());
            
            // 固定写死的内容
            mTerminalCodeView.setText("POS000008922");
            mAmountView.setText("¥11787.0");
        }
    }
}
